﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using chatc_application.connect;

namespace chatc_application.frame
{
    [Serializable]
    public partial class ClientChat : Form
    {
        private ConnectRemote con;
        private String username;

        public ClientChat(ConnectRemote con)
        {
            InitializeComponent();
            this.con = con;
            textBoxOnlinClients.Text = "\r\n********** \r\n Hover over to Refresh";
            
           
            
        }

      

        private void buttonSending_Click(object sender, EventArgs e)
        {
            con.sendMessage(username, textBoxSending.Text.ToString());
            textBoxSending.Text = "";
            //textBoxRceiving.Text = "asd";

        }
        public void TextSend(String MessageBulk) {
          
                Console.WriteLine("kommer ind i gui");

    MethodInvoker action = delegate
    { textBoxRceiving.Text += MessageBulk + "\n"; };
    textBoxRceiving.BeginInvoke(action);





                Console.WriteLine("kommer forbi text");
             
               
            
        }


        public void setUsername(String username)
        {
            this.username = username;
            labelWelcome.Text = "Welcome, " + this.username;
        }

        private void buttonR_Click(object sender, EventArgs e)
        {
            textBoxOnlinClients.Text = con.getOnlinePeople();
        }

        private void textBoxOnlinClients_MouseHover(object sender, EventArgs e)
        {
            textBoxOnlinClients.Text = con.getOnlinePeople() + "\r\n********** \r\n Hover over to Refresh";
        }

       
        
       

        
    }
}
